//
//  LBScrollViewDelegate.m
//  TEXT
//
//  Created by mac on 2025/3/2.
//  Copyright © 2025 刘博. All rights reserved.
//

#import "LBScrollViewDelegate.h"
#import <UIKit/UIKit.h>
#import "UITableViewCell+Event.h"
#import "UICollectionViewCell+Event.h"

@implementation LBScrollViewDelegate

// 自动轮播的开始，但是需要重点关注是否可能存在触发scrollViewDidScroll
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    //执行滚动
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    //开始拖动，执行曝光埋点
}

//
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
    //开始减速， 停止滚动
}

//
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    //停止减速
}

//
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    if (!decelerate) {
        //停止滚动
    }
}

//
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
    //
}

// 10.3.86 切换使用新方法代替点击捕获
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    [cell setMonitorSelected:YES];
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
    [cell setMonitorSelected:YES];
}

// 结束显示周期是准确的，但开始显示可能只显示一次，可能显示并不完全，所以暂只开了开始。
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self needCheckCellIn:tableView isStart:YES]) {
    }
}

- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self needCheckCellIn:collectionView isStart:YES]) {
    }
}

- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath
{

    if ([self needCheckCellIn:tableView isStart:NO]) {
    }
}

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self needCheckCellIn:collectionView isStart:NO]) {
    }
}

- (BOOL)needCheckCellIn:(UIView *)view isStart:(BOOL)start
{
    return YES;
}

@end
